/*
 * @Author: ljc
 * @Date: 2023-04-06 17:22:53
 * @LastEditors: g05047
 * @LastEditTime: 2023-04-27 12:10:22
 * @Description: 上传文档接口
 */

import {defAxios as request} from '@/utils/http'

/**
 * 获取附件规则
 *
 * @returns Proxy
 */
export function uploadFileRuleData(params) {
    return request({
        url: '/uploadFile/rule',
        method: 'post',
        data: params
    })
}

/**
 * 删除附件规则
 *
 * @returns Proxy
 */
export function delUploadFileData(fileId) {
    return request({
        url: `/uploadFile/delete/${fileId}`,
        method: 'post',
        data: {}
    })
}

/**
 * 预览文件
 *
 * @returns Proxy
 */
export function previewFileData(fileId) {
    return request({
        url: `/uploadFile/preview/${fileId}`,
        method: 'post',
        responseType: "blob",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
        },
    })
}

/**
 * 下载文件
 *
 * @returns Proxy
 */
export function downloadFileData(fileId) {
    return request({
        url: `/uploadFile/download/${fileId}`,
        method: 'post',
        responseType: "blob",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
        },
    })
}

export function uploadSzysFile(data) {
    return request({
        url: '/proResApply/parse',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data;'
        }
    })
}
